var chrome = chrome;
var core = core;
var window = window;

window.onload = function()
{
	core.window = window;

	core.window.onclick = function(e)
	{
		core.log = core.dom.zIndexMax;

		if(!core.note.isMouseOver)
		{
			core.dom.zIndex.down();
			for(var i = 0; i < core.notes.length; i++)
			{
				core.dom.hide('noteTextarea', i);
				core.dom.style('noteContent', i, 'noteContent');
			}
		}
	};

	core.window.oncontextmenu = function(e)
	{
		core.note.x = e.clientX + window.pageXOffset;
		core.note.y = e.clientY + window.pageYOffset;
	};

	chrome.runtime.onMessage.addListener
	(
		function(request)
		{
			core.log = request.message;//NOTE: test
		if(!core.note.isMouseOver)
			{
				core.note.create(core.note.x, core.note.y);
			}
		}
	);
};